﻿@{
    ViewBag.Title = "ServerList";
    Layout = "~/Views/Shared/Template.cshtml";
}

@using Partner.MVC.Models;
@{
    var user = Session["LoginUser"] as User_Info;
}


<link href="~/static/collect.css" rel="stylesheet" />
<link href="~/static/myhome.css" rel="stylesheet" />

<style>
    #divLeft {
        width: 24%;
    }

    #divContent {
        width: 75%;
    }
</style>

<div style="height: 300px;width: 100%;background:url(/static/hbweb/images/me.jpg);">
    <div class="container">
        <div class="header-message">
            <img class="fl" src="http://pic.huobanchina.com/o_1bp7omfg8e821pc4bbg1u8g1ifl9.jpeg" alt="" />
            <div class="fl header-text">
                <h3 class="user-name">@user.Use_Name </h3>
                <i class="icon-fabu3 point user-namei"></i>
            </div>
            <a href="#" class="fr fn-font-hover-blue change change-password">
                修改密码
            </a>
        </div>
    </div>
</div>

<div class="bgcSil">
    <div class="container">
        <div class="mt30" style="width: 100%">
            <ul id="divLeft" class="nav navbar-nav"></ul>
            <div id="divContent" class="fr mb80 cont">
                <div class="news-list-con bgcWhit">
                    <div class="news-list-info clearfix">
                        <ul>
                            @foreach (var a in Model)
                            {
                            <li class="pr">
                                <a class="fl" href="/f/information?id=adbedfc63077473997f9dfc9e23ea6e6" target="_blank">
                                    <img src="~/images/fangjian.jpg" alt="投融界2017每日融资报告（1.12）" />
                                </a>
                                <div class="news-note pr">
                                    <div class="rmb">
                                        <p><span style="color: red;font-size: 30px">3.0</span>千元/月</p>
                                        <p style="color:#979797 "><i class="icon-heart3"></i>收藏</p>
                                    </div>
                                    <h3>
                                        <a class="fcBlack">@a.S_Name - @a.S_Telphone</a>
                                        <span style="float:right;">
                                            <button onclick="Pass(@a.S_Id)" style="background:green;color:white;width:70px;height:28px;font-size:14px;">通过</button>
                                            <button onclick="Back(@a.S_Id)" style="background:red;color:white;width:70px;height:28px;font-size:14px;">驳回</button>
                                        </span>
                                    </h3>
                                    <p class="p"><span>简介：</span>&nbsp;&nbsp;&nbsp;<span>@a.S_Intro</span></p>
                                    <p>服务类型 ： @a.S_Type</p>
                                    <br />
                                </div>
                            </li>
                            }
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    ParentNav();
    // 绑定根节点
    function ParentNav() {
        $.ajax({
            type: "post",
            url: "/Partner/LeftNav",
            dataType: "json",
            success: function (data) {
                var htmltab = "";
                for (var i = 0; i < data.length; i++) {
                    htmltab += "<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" style=\"width: 175px;font-size: 16px;\">" + data[i].Lar_Name + "</a>" + SonNav(data[i].Limit_Id) + "</li>";
                }
                $("#divLeft").append(htmltab);
            },
            error: function (err) {
                alert(err);
            }
        })
    }
    // 绑定子节点
    function SonNav(id) {
        var html1 = "";
        $.ajax({
            type: "post",
            url: "/Partner/LeftSon",
            data: { pid: id },
            dataType: "json",
            async: false,
            success: function (data) {
                var strhtml = "<ul class=\"dropdown-menu\">"
                for (var i = 0; i < data.length; i++) {
                    strhtml += "<li><a href=\"" + data[i].Limit_Url + "\">" + data[i].Limit_Name + "</a></li>"
                }
                strhtml += "</ul>";
                html1 = strhtml;
            }
        })
        return html1;
    }

    //通过
    function Pass(id) {
        $.ajax({
            type: "post",
            url: "/AdminCenter/ServerPass?id=" + id,
            success: function (data) {
                if (data == 1) {
                    alert("审核通过！");
                    location.href = "/AdminCenter/ServerList";
                    return;
                }
                alert("通过失败！");
            }
        })
    }

    //驳回
    function Back(id) {
        $.ajax({
            type: "post",
            url: "/AdminCenter/ServerBack?id=" + id,
            success: function (data) {
                if (data == 1) {
                    alert("驳回成功！");
                    location.href = "/AdminCenter/ServerList";
                    return;
                }
                alert("驳回失败！");
            }
        })
    }
</script>
